package com.jc.camerascan.core.http.bean;

import com.xuexiang.xhttp2.model.ApiResult;

/**
 * @ProjectName: PhotoRecognition
 * @Package: com.jc.camerascan.core.http
 * @ClassName: CustomApiResult
 * @Description: java类作用描述
 * @Author: XuChi
 * @CreateDate: 2020/7/13 15:11
 * @Version: 1.0
 */
public class CustomApiResult <T> extends ApiResult<T> {

    private int resultCode;
    private String message;
//    private T data;

    public int getErrorCode() {
        return resultCode;
    }

    public CustomApiResult<T> setErrorCode(int resultCode) {
        this.resultCode = resultCode;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public CustomApiResult<T> setErrorInfo(String message) {
        this.message = message;
        return this;
    }

//    public T getResult() {
//        return data;
//    }
//
//    public CustomApiResult<T> setResult(T data) {
//        this.data = data;
//        return this;
//    }


    @Override
    public int getCode() {
        return resultCode;
    }

    @Override
    public String getMsg() {
        return message;
    }

    @Override
    public boolean isSuccess() {
        return resultCode == 200;
    }

//    @Override
//    public T getData() {
//        return data;
//    }

    @Override
    public String toString() {
        return "ApiResult{" +
                "errorCode='" + resultCode + '\'' +
                ", errorInfo='" + message + '\'' +
                ", result="+
                '}';
    }
}
